/**

 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    bool evaluateTree(TreeNode* root) 
    {
        //递归出口
        if(root->left == nullptr && root->right == nullptr)
        {
            if(root->val == 1) return true;
            else return false;
        }
        bool l = evaluateTree(root->left);
        bool r = evaluateTree(root->right);
        if(root->val == 3) 
            return l && r;
        else
            return l || r;

    }
};


/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    int sumNumbers(TreeNode* root) 
    {
        return dfs(root, 0);
    }

    int dfs(TreeNode* root, int prevSum)
    {
        if(root->left == nullptr && root->right == nullptr)
            return prevSum + root->val;
        
        int left = 0, right = 0;

        if(root->left)
            left = dfs(root->left, (root->val + prevSum) * 10);
        if(root->right)
            right = dfs(root->right, (root->val + prevSum) * 10);
        
        return left + right;

    }

};


/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    TreeNode* pruneTree(TreeNode* root) 
    {
        if(root == nullptr) return root;
        
        //后序遍历
        root->left = pruneTree(root->left);
        root->right = pruneTree(root->right);  

        if(root->val == 0 && root->left == nullptr && root->right == nullptr)
        {
            delete root;
            return nullptr;
        }

        return root;
    }
};

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:

    long prev = LONG_MIN; // 通过这个全局变量判断中序是否有序

    bool isValidBST(TreeNode* root) 
    {

        if(root == nullptr) return true;

        bool l = isValidBST(root->left);
        if(!l) return false; //剪枝
        
        bool cur = false;
        if(prev < root->val) 
        {
            cur = true;
        }
        if(!cur) return false; //剪枝
    
        prev = root->val;

        bool r = isValidBST(root->right);

        return l && r && cur;
    }
};

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
    int ret = 0;   //存放结果
    int count = 0; //递归结束条件
public:
    int kthSmallest(TreeNode* root, int k) 
    {
        count = k;
        dfs(root);
        return ret;
    }

    void dfs(TreeNode* root)
    {
        if(root == nullptr || count == 0) //剪枝
        {
            return;
        }

        dfs(root->left);

        count--;
        if(count == 0)
            ret = root->val;
        
        dfs(root->right);

    }
};

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
    vector<string> ret;
    string path;
public:
    vector<string> binaryTreePaths(TreeNode* root) 
    {
        dfs(root);
        return ret;
    }

    void dfs(TreeNode* root)
    {
        if(!root)
            return;
        
        //前序遍历

        if(root->left == nullptr && root->right == nullptr)
        {
            path += to_string(root->val);
            ret.push_back(path);
            path.pop_back();
        }
        else
        {
            path += to_string(root->val);
            path += "->";
        }

        dfs(root->left);
        dfs(root->right);
        if(path.size() > 3)
        {
            path.pop_back();
            path.pop_back();
            path.pop_back();
        }

    }
};

class Solution {
    vector<vector<int>> ret;
    vector<int> path;
    bool check[7];
public:

    vector<vector<int>> permute(vector<int>& nums) 
    {
        dfs(nums);
        return ret;
    }

    void dfs(vector<int>& nums)
    {
        //递归出口
        if(nums.size() == path.size())
        {
            ret.push_back(path);
            return;
        }

        for(int i = 0; i < nums.size(); i++)
        {
            if(check[i] == false)
            {
                path.push_back(nums[i]);
                check[i] = true;
                dfs(nums);
                //回溯、剪枝
                path.pop_back();
                check[i] = false;

            }
        }

    }
};

class Solution {
    vector<vector<int>> ret;
    vector<int> path;
public:
    vector<vector<int>> subsets(vector<int>& nums) 
    {
        dfs(nums, 0);
        return ret;
    }

    void dfs(vector<int>& nums, int i)
    {
        if(i == nums.size())
        {
            ret.push_back(path);
            return;
        }

        dfs(nums, i+1);
        
        path.push_back(nums[i]);
        dfs(nums, i+1);

        path.pop_back();
    }
};

class Solution {
    vector<vector<int>> ret;
    vector<int> path;
public:
    vector<vector<int>> subsets(vector<int>& nums) 
    {
        dfs(nums, 0);
        return ret;
    }

    void dfs(vector<int>& nums, int pos)
    {
        ret.push_back(path);

        for(int i = pos; i < nums.size(); i++)
        {
            path.push_back(nums[i]);
            
            dfs(nums, i+1);
            path.pop_back();
        }
    }
};

#include <iostream>
using namespace std;

int main() 
{
    string str, st;
    cin >> str;

    for(char ch : str)
    {   
        if(!st.empty() && st.back() == ch)
        {
            st.pop_back();
        }
        else 
        {
            st += ch;
        }

    }
    cout << (st.size() == 0 ? "0" : st) << endl;

    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main() 
{
    float a;
    char b;
    cin >> a >> b;
    int ret = 0;
    if(a <= 1.0)
    {
        ret += 20;
    }
    else 
    {
        //ret += ceil(a-1.0);//浮点数向上取整库函数
        ret += 20;
        double c = a - 1.0;
        if(c - (int)c > 0) ret += (int)c + 1;
        else ret += (int)c;
    }

    if(b == 'y') ret += 5;

    cout << ret << endl;

    return 0;    
}

class Solution {
    int path = 0;
    int sum = 0;

public:
    int subsetXORSum(vector<int>& nums) 
    {
        dfs(nums, 0);
        return sum;
    }

    void dfs(vector<int>& nums, int pos)
    {
        sum += path;
        for(int i = pos; i < nums.size(); i++)
        {
            path ^= nums[i];
            dfs(nums, i + 1);
            path ^= nums[i];
        }
    }   
};

#include<iostream>
#include<vector>

using namespace std;

int main()
{
    int n , x;
    cin >> n >> x;
    
    vector<int> v(n);
    for(int i = 0; i < n; i++)
        cin>>v[i];
    
    int l, r, left = 0, right = 0, len = INT32_MAX, sum = 0;
    while(right < n)
    {
        sum += v[right];
        while(sum >= x)
        {
            if(right - left + 1 < len)
            {
                len = right - left + 1;
                l = left + 1;
                r = right + 1;
            }
            
            sum -= v[left++];
        }
        
         ++right;
    }
    cout << l << " " << r << endl;
    return 0;
}

#include <vector>
using namespace std;
class Solution {
  public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     *
     * @param board string字符串vector
     * @param word string字符串
     * @return bool布尔型
     */


    int n, m;
    vector<vector<bool>> visi;
    vector<int> dx = {0,0,-1,1};
    vector<int> dy = {1,-1,0,0};


    bool exist(vector<string>& board, string word)
    {
        for(int i = 0; i < n; i++)
        
            for(int j = 0; j < m; j++)
        int n = board.size(), m = board[0].size();

        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < m; j++)
            {
                if(board[i][j] == word[0])
                {
                   if(dfs(board, i, j, word, 0)) return true;
                }
            }
        }
        return false;
    }

    bool dfs(vector<string>& board, int i, int j, string& word, int pos)
    {
        if(pos == word.size() - 1)
            return true;
        
        visi[i][j] = true;

        for(int k = 0; k < 4; k++)
        {
            int a = i + dx[k], b = j + dy[k];
            if(a >= 0 && a < n && b >= 0 && b < m && !visi[a][b] && board[a][b] == word[pos + 1])
            {
                if(dfs(board, a, b, word, pos + 1)) return true;
            }

        }
        visi[i][j] = false;

        return false;
    }

};

class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param grid int整型vector<vector<>> 
     * @return int整型
     */

    int n,m;
    int dx[4] = {0, 0, 1, -1};
    int dy[4] = {1, -1, 0, 0};
    bool visi[1001][1001] = {0};
    int rotApple(vector<vector<int> >& grid) 
    {
        int n = grid.size(), m = grid[0].size();
        queue<pair<int, int>> q;

        for(int i = 0; i < n; i++)
            for(int j = 0; j < m; j++)
                if(grid[i][j] == 2)
                    q.push({i, j});
        
        int ret = 0;
        while(q.size())
        {
            int sz = q.size();
            ret++;
            while(sz--)
            {
                auto[a, b] = q.front();
                q.pop();
                for(int i = 0; i < 4; i++)
                {
                    int x = dx[i] + a, y = dy[i] + b;
                    if(x >= 0 && x < n && y >= 0 && y < m && grid[x][y] == 1 && !visi[x][y])
                    {
                        visi[x][y] = true;
                        q.push({x, y});
                    }
                }
            }
        }

        for(int i = 0; i < n; i++)
            for(int j = 0; j < m; j++)
            if(grid[i][j] == 1 && !visi[i][j])  return -1;

        return ret - 1;
    }
};

#include <iterator>
#include <memory>
#include <string>
#include <vector>
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param s string字符串 第一个整数
     * @param t string字符串 第二个整数
     * @return string字符串
     */
    string solve(string s, string t) 
    {
        reverse(s.begin(), s.end());
        reverse(t.begin(), t.end());

        int n = s.size(), m = t.size();

        //无进位相乘
        vector<int> tmp(m + n);
        for(int i = 0; i < n; i++)
            for(int j  = 0; j < m; j++)
                tmp[i + j] += (s[i] - '0') * (t[j] - '0');

        //进位相加
        int c = 0;
        string ret;

        for(auto x : tmp)
        {
            c += x;
            ret += c % 10 + '0';
            c /= 10;
        }

        while(c)
        {
            ret += c % 10 + '0';
            c /= 10;
        }

        //处理前导0
        while (ret.size() > 1 && ret.back() == '0') 
           ret.pop_back();
        
        reverse(ret.begin(), ret.end());
        return ret;
    }

};

class Solution {
    vector<vector<int>> ret;
    vector<int> path;
    bool check[9] = {false};

public:
    vector<vector<int>> permuteUnique(vector<int>& nums) 
    {
        sort(nums.begin(), nums.end()); //方便剪枝
        
        dfs(nums, 0);

        return ret;
    }

    void dfs(vector<int>& nums, int pos)
    {
        if(pos == nums.size())
        {
            ret.push_back(path);
            return;
        }

        for(int i = 0; i < nums.size(); i++)
        {
            if(check[i] == false && (i == 0 || nums[i] != nums[i - 1] || check[i - 1] != false))
            {            
                path.push_back(nums[i]);
                check[i] = true;

                dfs(nums, pos + 1);

                path.pop_back();
                check[i] = false;
            }
        }
    }
};

class Solution 
{
    string hash[10] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    vector<string> ret;
    string path;
public:
    vector<string> letterCombinations(string digits) 
    {
        if(digits.size() == 0)
            return ret;

        dfs(digits, 0);
        return ret;
    }

    void dfs(const string& digits, int pos)
    {
        if(pos == digits.size())
        {
            ret.push_back(path);
            return;
        }

        for(auto ch : hash[digits[pos] - '0'])
        {
            path.push_back(ch);
            dfs(digits, pos+1);
            path.pop_back();
        }

    }

};
class Solution 
{
    string hash[10] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
    vector<string> ret;
    string path;
public:
    vector<string> letterCombinations(string digits) 
    {
        if(digits.size() == 0)
            return ret;

        dfs(digits, 0);
        return ret;
    }

    void dfs(const string& digits, int pos)
    {
        if(pos == digits.size())
        {
            ret.push_back(path);
            return;
        }

        for(auto ch : hash[digits[pos] - '0'])
        {
            path.push_back(ch);
            dfs(digits, pos+1);
            path.pop_back();
        }

    }

};

class Solution {
    int left, right, n;
    string path;
    vector<string> ret;

public:
    vector<string> generateParenthesis(int _n) 
    {
        n = _n;
        dfs();
        return ret;
    }

    void dfs()
    {
        if(right == n)
        {
            ret.push_back(path);
            return;
        }

        if(left < n)
        {
            path.push_back('(');
            left++;
            dfs();
            path.pop_back();
            left--;
        }

        if(right < left)
        {
            path.push_back(')');
            right++;
            dfs();
            path.pop_back();
            right--;
        }
    }

};

class Solution {
public:
    // 滚动数组优化
    // int tribonacci(int n) 
    // {
    //     if(n == 0) return 0;
    //     if(n == 1 || n == 2) return 1;

    //     int ret = 0 , a = 0, b = 1, c = 1;

    //     for(int i = 3; i <= n; i++)
    //     {
    //         ret = a + b + c;
    //         a = b;
    //         b = c;
    //         c = ret;
    //     }

    //     return ret;
    // }

    int tribonacci(int n) 
    {
        if(n == 0) return 0;
        if(n == 1 || n == 2) return 1;

        vector<int> dp(n + 1);
        dp[0] = 0;
        dp[1] = 1;
        dp[2] = 1;

        for(int i = 3; i <= n; i++)
        {
            dp[i] = dp[i-3] + dp[i-2] + dp[i - 1];
        }

        return dp[n];
    }
};

class Solution {
    vector<int> path;
    vector<vector<int>> ret;
    int n, k;
public:
    vector<vector<int>> combine(int _n, int _k) 
    {
        n = _n;
        k = _k;
        dfs(1);
        return ret;
    }

    void dfs(int start)
    {
        if(path.size() == k)
        {
            ret.push_back(path);
        }

        for(int i = start; i <= n; i++)
        {
            path.push_back(i);
            dfs(i+1);
            path.pop_back();
        }
    }
};